<%@ page contentType="text/html; charset=UTF-8" language="java" isErrorPage="false" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组织卡片</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
    <link rel="Shortcut Icon" href="../../images/logo.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/css/bootstrap.css">
    <link rel="stylesheet" href="/css/font-awesome.min.css">
</head>
<body>
    <!-- 头部导航栏 -->
    <%@ include file="../header.jsp"%>
    <!-- 头像上栏 -->
    <section class="mt-4">
        <div class="container">
            <!-- 用户卡片头部 -->
           <div class="row justify-content-center shadow-sm">
               <div class="col-2">
                   <figure class="figure">
                       <img src="${info.photo}" class="figure-img img-fluid rounded-circle shadow" style="width: 100px; height: 100px" alt="头像">
                       <figcaption class="figure-caption text-center font-weight-bold">${info.nickname}<i class="fa fa-certificate text-danger ml-1" aria-hidden="true"></i> </figcaption>
                       <figcaption class="text-primary text-center small" id="username">@${info.username}</figcaption>
                       <figcaption class="text-info text-center small">${info.association.identify_name}</figcaption>
                   </figure>
               </div>
           </div>
        </div>
    </section>

    <!-- 功能按钮组 -->
    <section class="">
        <div class="container">
            <div class="row justify-content-end ml-5">
                <div class="col-3 d-xl-block d-none" style="margin-top: -40px;">
                    <div class="btn-group" role="group" aria-label="Basic example">
                        <button type="button" class="btn btn-outline-primary" onclick="like(${info.uid})"><i class="fa fa-thumbs-o-up" aria-hidden="true"></i>点赞<span class="badge badge-light text-muted" id="likenum_max">${info.likes}</span></button>
                        <button type="button" class="btn btn-outline-danger"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>举报</button>
                        <button type="button" class="btn btn-outline-info" onclick="toSend()"><i class="fa fa-commenting-o" aria-hidden="true"></i>私信</button>
                    </div>
                </div>
            </div>
            <div class="row justify-content-center mt-2">
                <div class="d-xl-none d-md-block col-8 ml-5 text-center">
                    <div class="btn-group" role="group" aria-label="Basic example">
                        <button type="button" class="btn btn-outline-primary" onclick="like(${info.uid})"><i class="fa fa-thumbs-o-up" aria-hidden="true"></i>点赞<span class="badge badge-light text-muted" id="likenum_min">${info.likes}</span></button>
                        <button type="button" class="btn btn-outline-danger"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i>举报</button>
                        <button type="button" class="btn btn-outline-info" onclick="toSend()"><i class="fa fa-commenting-o" aria-hidden="true"></i>私信</button>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- 资料框 -->
    <section class="mt-1">
        <div class="container">
            <div class="row justify-content-center">
                <!-- 基本信息资料框 -->
                <div class="col-sm-12 col-lg-8 mt-3">
                    <div class="card">
                        <div class="card-body">
                            <h6 class="card-title text-primary font-weight-normal"><i class="fa fa-info text-info mr-2" aria-hidden="true"></i>基本信息</h6>
                            <div class="row">
                                <div class="col-lg-3 col-6 card-text">
                                    <p class="text-muted"><i class="fa fa-smile-o mr-2" aria-hidden="true"></i>组织名称:</p>
                                    <p><i class="fa fa-weixin mr-2" aria-hidden="true"></i> 公众号：</p>
                                </div>
                                <div class="col-lg-3 col-6 card-text text-right">
                                    <p>${info.association.identify_name}</p>
                                    <p>${info.association.wechat == null?"无":info.association.wechat}</p>
                                </div>
                                <div class="col-lg-3 col-6 card-text text-muted">
                                    <p class="text-muted"><i class="fa fa-list mr-2" aria-hidden="true"></i>类别:</p>
                                    <p><i class="fa fa-envelope-o mr-2" aria-hidden="true"></i>联系邮箱:</p>
                                </div>
                                <div class="col-lg-3 col-6 card-text text-right">
                                    <p>
                                    <c:choose>
                                        <c:when test="${info.association.identify_type == 1}">
                                            校级
                                        </c:when>
                                        <c:when test="${info.association.identify_type == 2}">
                                            院级
                                        </c:when>
                                        <c:otherwise>
                                            协会
                                        </c:otherwise>
                                    </c:choose>
                                    </p>
                                    <p>${info.email == null?"无":info.email}</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 个人简介 -->
                <div class="col-sm-12 col-lg-8 mt-3">
                    <div class="card">
                        <div class="card-body">
                            <h6 class="card-title text-primary font-weight-normal"><i class="fa fa-hand-peace-o mr-2" aria-hidden="true"></i>组织简介</h6>
                            <div class="card-text">${info.description == null?"无":info.description}</div>
                        </div>
                    </div>
                </div>

                <!-- 近期发布的活动 -->
                <div class="col-sm-12 col-lg-8 mt-3 mb-3">
                    <div class="card">
                        <div class="card-body">
                            <h6 class="card-title text-primary font-weight-normal"><i class="fa fa-car mr-2" aria-hidden="true"></i></i>近期发布的活动：</h6>
                            <div class="card-text">Nothing....</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
            </div>
        </div>
    </section>

    <!--引入JQuery,再引入popper.js，最后引入bootstrap.js-->
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.bundle.js"></script>
    <script src="/js/action.js"></script>
    <script src="/js/message.js"></script>
    <script>
        function toSend() {
            let username = document.getElementById("username").innerHTML.replace("@","");

            window.location.href = '/message/send?friendname=' + username;
        }
    </script>

</body>
</html>